import java.util.Arrays;

class Animal {
    public String name;
    public int age;

    public void eat() {
        System.out.println(name+"在吃饭");
    }
}

class Dog extends Animal {
    public void wangwang() {
        System.out.println(name+"在汪汪叫");
    }
}

class Cat extends Animal {
    public void miaomiao() {
        System.out.println(name+"在喵喵叫");
    }
}

class MyValue {
    public int value;
}

public class Test {

    public static void mySwap(MyValue myV1, MyValue myV2) {
        int tmp = myV1.value;
        myV1.value = myV2.value;
        myV2.value = tmp;
    }

    public static void main(String[] args) {
        MyValue myValue1 =new MyValue();
        myValue1.value = 10;
        MyValue myValue2 =new MyValue();
        myValue2.value = 20;
        mySwap(myValue1,myValue2);
        System.out.println(myValue1.value);
        System.out.println(myValue2.value);
    }

    public static void main3(String[] args) {
        Dog dog = new Dog();
        dog.name = "三斤";
        dog.eat();
        dog.wangwang();

        Cat cat = new Cat();
        cat.name = "来福";
        cat.eat();
        cat.miaomiao();
    }

    private static void swap(int[] array1,int[] array2) {
        for (int i = 0; i < array1.length; i++) {
            int tmp = array1[i];
            array1[i] =array2[i];
            array2[i] = tmp;
        }
    }

    public static void main2(String[] args) {
        int[] array1 = {1,2,3,4,5,6};
        int[] array2 ={9,8,7,6,5,4};
        swap(array1,array2);
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));
    }

    public static void func1(int[] array) {
        int left =0;
        int right =array.length-1;
        while (left < right) {
            while (left < right && array[left]%2 == 0) {
                left++;
            }
            while (left < right && array[right]%2 != 0){
                right--;
            }
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
    }

    public static void main1(String[] args) {
        int[] array = {1,2,3,4,5,6};
        func1(array);
        System.out.println(Arrays.toString(array));
    }

}
